package com.tax.util;

public class TaxCalcutor {
	
	public double adjustTax(double taxBaseSalary){
		double tax=0;
		if(taxBaseSalary<0)
			return tax;
		if((taxBaseSalary)<1500)
			tax=(taxBaseSalary)*0.05;
		if((taxBaseSalary)<4500)
			tax=1500*0.05+(taxBaseSalary-1500)*0.1;
		if((taxBaseSalary)<9000)
			tax=1500*0.05+3000*0.1+(taxBaseSalary-4500)*0.2;
		return tax;
	}
	
	public double originalTax(double taxBaseSalary){
		double tax=0;
		if(taxBaseSalary<0)
			return tax;
		if((taxBaseSalary)<500)
			tax=(taxBaseSalary)*0.05;
		if((taxBaseSalary)<2000)
			tax=500*0.05+(taxBaseSalary-500)*0.1;
		if((taxBaseSalary)<5000)
			tax=500*0.05+1500*0.1+(taxBaseSalary-2000)*0.15;
		if((taxBaseSalary)<20000)
			tax=500*0.05+1500*0.1+3000*0.15+(taxBaseSalary-5000)*0.20;
		return tax;
	}
	
	public static void main(String[] args){
		double taxBaseSalary=12000-9600*0.22;
		double virTaxBaseSalary=15000-12000*0.22;
		TaxCalcutor cal=new TaxCalcutor();
		System.out.println(taxBaseSalary-cal.adjustTax(taxBaseSalary-3000));
		System.out.println(virTaxBaseSalary-cal.adjustTax(virTaxBaseSalary-3000));
		System.out.println(taxBaseSalary-cal.originalTax(taxBaseSalary-2000));
		System.out.println(virTaxBaseSalary-cal.originalTax(virTaxBaseSalary-2000));
		
	}
}
